package com.clarence.dada.modular.system.dict.entity.req;

import com.clarence.dada.core.base.BaseReq;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 字典请求参数封装
 *
 * @author GD
 * @since 2020/10/30 11:04
 */
@Data
@Schema(title = "系统字典请求实例")
@EqualsAndHashCode(callSuper = true)
public class DictReq extends BaseReq {

    /**
     * 字典id
     */
    @NotNull(message = "id不能为空", groups = {edit.class, delete.class, detail.class, updateStatus.class})
    @Schema(title = "字典id", example = "admin")
    private Long dictId;

    /**
     * 字典编码
     */
    @NotBlank(message = "字典编码不能为空", groups = {add.class, edit.class, validateAvailable.class})
    @Schema(title = "字典编码", example = "admin")
    private String dictCode;

    /**
     * 字典名称
     */
    @NotBlank(message = "字典名称不能为空", groups = {add.class, edit.class})
    @Schema(title = "字典名称", example = "admin")
    private String dictName;

    /**
     * 字典类型编码
     */
    @NotBlank(message = "字典类型编码不能为空", groups = {add.class, edit.class, treeList.class, dictZTree.class})
    @Schema(title = "字典类型编码", example = "admin")
    private String dictTypeCode;

    /**
     * 字典简称
     */
    @Schema(title = "字典简称", example = "admin")
    private String dictShortName;

    /**
     * 字典简称的编码
     */
    @Schema(title = "字典简称的编码", example = "admin")
    private String dictShortCode;

    /**
     * 排序，带小数点
     */
    @NotNull(message = "排序不能为空", groups = {add.class, edit.class})
    @Schema(title = "排序", example = "admin")
    private BigDecimal dictSort;

    /**
     * 获取树形列表
     */
    public @interface treeList {

    }

    /**
     * 校验编码是否重复
     */
    public @interface validateAvailable {

    }

    /**
     * 校验zTree必备参数
     */
    public @interface dictZTree {

    }

}
